import './styles/global.scss'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
//demo展示路由 测试组件 start
// import router from '@/components/NewMesssageArea/testRouter'
// import App from '@/components/NewMesssageArea/index.vue'
// import './mock/index.js'
//demo展示路由 测试组件 end/index.v

const app = createApp(App)
// 注册全局指令
import vLoading from './directives/loading'
import vLazy from './directives/lazy'
app.directive('lazy', vLazy)
app.directive('loading', vLoading)

import showMessage from './utils/showMessage'

//挂载事务总线为全局属性
import eventBus from './eventBus' //第三方事务总线
app.config.globalProperties.$mybus = eventBus
//弹框
app.config.globalProperties.$showMessage = showMessage
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(createPinia())
app.use(router)
app.use(ElementPlus)

//初始化页面设置信息start
import { useSettings } from '@/stores/useSettingsStore.js'
const { fetchSetting } = useSettings()
fetchSetting()
//初始化页面设置信息end

app.mount('#app')
